import os

from autogen import ConversableAgent

# 配置中文LLM
llm_config = {
    "config_list": [
        {
            # "model": "qwen-turbo",
            "model": "qwen-plus-latest",
            "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
            "api_key":os.environ["DASHSCOPE_API_KEY"]
        },
        # {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}
    ],
}

agent = ConversableAgent(
    "chatbot",
    llm_config=llm_config,
    code_execution_config=False,  # Turn off code execution, by default it is off.
    function_map=None,  # No registered functions, by default it is None.
    human_input_mode="NEVER",  # Never ask for human input.
)

# reply = agent.generate_reply(messages=[{"content": "请给我讲一个关于拖鞋的笑话。", "role": "user"}])
# print(reply)

cathy = ConversableAgent(
    "hong",
    system_message="Your name is Cathy and you are a part of a duo of comedians.",
    llm_config=llm_config,
    human_input_mode="NEVER",  # Never ask for human input.
)

joe = ConversableAgent(
    "gang",
    system_message="Your name is Joe and you are a part of a duo of comedians.",
    llm_config=llm_config,
    human_input_mode="NEVER",  # Never ask for human input.
)

result = joe.initiate_chat(cathy, message="Please give us a joke!", max_turns=2)
print(result)

